﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using sonicERPinfo;
using sonicERPDAL;
using System.Data;
using Microsoft.Reporting;
using Microsoft.Reporting.WebForms;





namespace sonicERPinterface.Charp
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        #region "variaveis globais"

        Util util = new Util();
        ClienteDAL dal = new ClienteDAL();
        Tabelainfo entidade = new Tabelainfo();

        #endregion
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
             
            }

        }

        protected void btnxml_Click(object sender, EventArgs e)
        {
            UsuarioDAL usuariodal = new UsuarioDAL();
            DataTable dt = usuariodal.getusuario_historico();
            string caminhoxml = "xml\\Historico.xml";

            util.gerarxml(dt, caminhoxml, "cliente");


        }

        #region "Funções e Procedimentos"
        //public void getreport()
        //{
        //    ReportViewer1.LocalReport.DataSources.Clear();
        //    ObjectDataSource obj = new ObjectDataSource();
        //    obj.TypeName = "sonicERPinterface.Charp.WebForm1";
        //    obj.SelectMethod = "getdados";
             

        //    ReportDataSource rptd = new ReportDataSource("obj", "Dataset1");
        //    DataSet ds = getdados();
        //    rptd.DataMember = "cliente";
        //    rptd.Value = ds.Tables[0];
        //    ReportViewer1.ProcessingMode = ProcessingMode.Remote;
        //    string caminhoreport = HttpContext.Current.Server.MapPath("~/Report\\Report1.rdlc");
        //  ReportViewer1.LocalReport.ReportPath = caminhoreport;

        //    ReportViewer1.LocalReport.DataSources.Add(rptd);
        //    ReportViewer1.DataBind();
        //    ReportViewer1.LocalReport.Refresh();
        //}

        //public DataSet getdados()
        //{
        //      DataView dv = dal.Getlista(entidade);
        //    DataTable dt = dv.ToTable();
        //    DataSet ds = new DataSet("Dataset1");
        //    ds.Tables.Add(dt);

        //    return ds;

        //}
        #endregion

    }
}
